package factory;

import model.Categoria;
import model.Cliente;
import model.Departamento;
import model.Endereco;
import model.Entrega;
import model.Fornecedor;
import model.Item;
import model.NotaFiscal;
import model.Produto;
import dao.DAO;

public abstract class DAOFactory {

	public static final int JDBC = 1;

	public static final int JPA = 2;

	public abstract <T> T openConnection();

	public abstract <T> void closeConnection(T connection);

	public abstract <T> T getFactory();
	
	public abstract  DAO<Cliente> getClienteDAO();
	
	public abstract  DAO<Categoria> getCategoriaDAO();
	
	public abstract  DAO<Fornecedor> getFornecedorDAO();
	
	public abstract  DAO<Produto> getProdutoDAO();
	
	public abstract  DAO<Item> getItemDAO();
	
	public abstract  DAO<NotaFiscal> getNotaFiscalDAO();
	
	public abstract  DAO<Departamento> getDepartamentoDAO();
	
	public abstract  DAO<Endereco> getEnderecoDAO();
	
	public abstract  DAO<Entrega> getEntregaDAO();

	public static DAOFactory getDAOfactory(int factoryType) {
		switch (factoryType) {
		case 2:
			return JPADAOFactory.getInstance();

		default:
			return null;
		}
	}

}
